/*
 * @Author: wanghongji
 * @Description: 文件服务小工具
 * @Email: hjm100@126.com
 * @LastEditors: wanghongji
 * @Date: 2020-12-22 18:17:03
 * @LastEditTime: 2021-08-09 16:50:42
 */

interface NameAndPath {
  name: string;
  path: string;
}

export const getNameAndPath = (filePath: string): NameAndPath => {
  const index = filePath.lastIndexOf('/'); // 获取最后一个文件后缀
  return {
    name: filePath.substr(index + 1),
    path: filePath.substr(0, index),
  };
};
